<template>
    <date-picker
        :label="label"
        v-model="date"
        :rules="rules"
        :max="max"
        :min="min"
    />
</template>

<script lang="ts">
import Vue from 'vue';
import DatePicker from './DatePicker.vue';

export default Vue.extend({
    components: {
        DatePicker,
    },
    props: {
        label: {
            type: String,
            default: 'Date',
        },
        value: {
            type: String,
            default: '',
        },
        rules: {
        },
        max: {
            type: String,
            default: new Date().toISOString().substr(0, 10),
        },
        min: {
            type: String,
            default: '1950-01-01',
        },
    },
    data(): {
        date: string;
        } {
        return {
            date: this.value,
        };
    },
    watch: {
        date() {
            this.$emit('input', this.date);
        },
    },
});
</script>
